import { Entity } from "../../../../../../Core/Module/Entity/Entity";
import { SceneType } from "../../../../../../Core/Module/Entity/SceneType";
import { HttpListenerContext } from "../../../../../../Core/System/Server/HttpListenerContext";
import { HttpHandlerAttribute } from "../../../../../../Decorator/Decorator"
import { ETTask } from "../../../../../../Support/Share/Lib/Async/ETTask";
import { HttpGetRouterResponse } from "../../../../../Model/Generate/Share/Message/OuterMessage_C_10001";
import { IHttpHandler } from "../../../../../Model/Server/Module/Http/IHttpHandler";
import { HttpHelper } from "../../Helper/HttpHelper";

@HttpHandlerAttribute(SceneType.RouterManager, "/get_router")
export class HttpGetRouterHandler extends IHttpHandler {

    public async Handle(domain: Entity, context: HttpListenerContext) {
        // console.log(`HttpGetRouterHandler.Handle`);
        const response = new HttpGetRouterResponse();
        // foreach(StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.Realms)
        // {
        //     response.Realms.Add(startSceneConfig.InnerIPOutPort.toString());
        // }
        // foreach(StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.Routers)
        // {
        //     response.Routers.Add($"{startSceneConfig.StartProcessConfig.OuterIP}:{startSceneConfig.OuterPort}");
        // }
        HttpHelper.Response(context, response);
        await ETTask.CompletedTask;
    }
}